home *** CD-ROM | disk | FTP | other *** search
/ .net (Poland) 2000 September / Magazyn_Net_09_2000 (CDB).iso / offline / R1 / help / getcleverwin / registrier_win2.asp < prev    next >
Encoding:
Text File  |  2000-10-12  |  2.2 KB  |  50 lines

  1. <?
  2. include ("../lib/config/global_config.php3");
  3. include ("../lib/phpDB/connect.php3");
  4. include ("../lib/phpDB/db.php3");
  5. $db=new db_connect;
  6. $db->openDB($global_DBServer,$global_DBUser,$global_DBPassword);
  7. $db->setDatabase($global_DBName);
  8. $errors = "0000000000"; //firstname|lastname|day|month|year
  9. if (!ereg("^([a-zA-Z\-\ \.]+)$",$firstname) || $firstname=="")         $errors[0]=1;
  10. if (!ereg("^([a-zA-Z\-\ \.]+)$",$lastname) || $lastname=="")              $errors[1]=1;
  11. //if (!ereg("^[0-9]",$age))                                           $errors[2]=1;
  12. if (!$street||$street=="")                                                 $errors[2]=1;
  13. if ($day<1 || $day> 31)                                             $errors[3]=1;
  14. if ($month<1 || $month>12)                                                          $errors[4]=1;
  15. if ($year <1900 || $year>1995)                                                  $errors[5]=1;
  16. if (!isset($zip) ||$zip=="")                                                      $errors[7]=1;
  17. if ($country==0)                                                    $errors[8]=1;
  18. if ($smoker[0] == 1 && (!ereg("^([a-zA-Z\-\ \.]+)$",$brand) || $brand=="")) $errors[9]=1;
  19.  
  20. $JetztTag = Date("d");
  21. $JetztMonat = Date("m");
  22. $JetztJahr = Date("Y");
  23. $JetztJahr -= 18;
  24.  
  25. $JetztDatum = "$JetztJahr-$JetztMonat-$JetztTag";
  26. $GebDat = "$year-$month-$day";
  27.  
  28.  
  29. if ($errors!=0000000000) Header("Location:registrier_win.php3?$QUERY_STRING&errors=$errors&eingaben&version=$version#eingaben");
  30. else if ($JetztDatum < $GebDat)
  31.     {
  32.      Header("Location:too_young.php3?version=$version&firstname=$firstname");
  33.     }
  34. else
  35.     {
  36.         if ($day<10) $day="0".$day;
  37.         if ($month<10) $month="0".$month;
  38.         $dbquery=new db_query;
  39.         $dbquery->db_connect($db);
  40.         $querystring = "INSERT INTO gewinnspiel_user (name,vorname,bday,weiblich,adresse,telefon,plz,land,loesungswort,raucher,marke,ichwill,bildid) VALUES ('$lastname','$firstname',".$year.$month.$day.",$weiblich,'$street','$phone','$zip',$country,'$lwort',$smoker,'$brand',$ichwill,$bildid)";
  41.         $dbquery->sendQuery($querystring);
  42.         if (mysql_error()!="") 
  43.             {
  44.                 echo "MySQL Error <b>".mysql_error();
  45.                 echo "</b> occured trying to process query <br><b>$querystring</b>";
  46.             }
  47.         else Header("Location:bestaet_win.php3?version=$version&firstname=$firstname");
  48.     }
  49. ?>
  50.